<?php
include("cabecalho.php");
// ------------------------------------------Preenche select instituição ---
$selectArea = "";
$objArea = new Area();
$inst = $objArea->listar();                        // vem da classe
foreach ($inst as $item) {
    $selectArea .= '<option value="' . $item->idarea . '" >' . $item->idarea . ' - ' . $item->desc_area . '</option>';
}
// -----------------------------------------------Fim select instituição ---
?>

<br>
<div class="container">
    <div class="row">
        <div class="col-md-12 text-left">
            <div class="navbar navbar-default">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand">Cadastro de Sub-Área</a>
                </div>
                <div class="collapse navbar-collapse navbar-ex1-collapse">
                    <ul class="nav navbar-nav navbar-left">
                        <li><a href="subarea.php">Menu Área</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="container">
    <div class="row">
        <div class="col-md-4"></div>
        <div class="col-md-4">
            <form role="form" action="subarea-add-ok.php" method="POST">
                <div class="form-group">
                    <label>Área</label>
                    <select class="form-control" name="idarea">
                        <?php echo $selectArea; ?>
                    </select>
                </div>
                <div class="form-group">
                    <label>Sub-Área</label>
                    <input class="form-control" name="desc_subarea" autofocus required autofocus placeholder="Nome da Sub-Área" maxlength="200" type="text">
                </div>
                <button type="submit" class="btn btn-success">Gravar</button>
                <button type="reset"  class="btn btn-info">Limpar</button>
            </form>
        </div>
    </div>
</div>